package com.hksj.Intelligentmanagement.controller;

import com.hksj.Intelligentmanagement.common.Result;
import com.hksj.Intelligentmanagement.dto.CallDeviceScreenDTO;
import com.hksj.Intelligentmanagement.service.CallDeviceScreenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@Api(tags = "呼叫设备管理")
@RestController
@RequestMapping("/api/callEquipment")
public class CallDeviceScreenController {
    @Autowired
    private CallDeviceScreenService callEquipmentService;

    @ApiOperation("新增呼叫设备信息")
    @PostMapping("/createCallDeviceScreen")
    public Result createCallDeviceScreen(@Valid @RequestBody CallDeviceScreenDTO deviceScreenDTO) {
        return callEquipmentService.createCallDeviceScreen(deviceScreenDTO);
    }

    @ApiOperation("删除呼叫设备信息")
    @DeleteMapping("/deleteCallDeviceScreen/{id}")
    public Result deleteCallDeviceScreen(@PathVariable("id") String id) {
        return callEquipmentService.deleteCallDeviceScreen(id);
    }

    @ApiOperation("修改呼叫设备信息")
    @PutMapping("/updateCallDeviceScreen")
    public Result updateCallDeviceScreen(@Valid @RequestBody CallDeviceScreenDTO deviceScreenDTO) {
        return callEquipmentService.updateCallDeviceScreen(deviceScreenDTO);
    }

    @ApiOperation("根据id查询呼叫设备信息")
    @GetMapping("/queryCallDeviceScreenById/{id}")
    public Result queryCallDeviceScreenById(@PathVariable String id) {
        return callEquipmentService.queryCallDeviceScreenById(id);
    }

    @ApiOperation("动态分页模糊查询呼叫设备信息列表")
    @PostMapping("/queryCallDeviceScreenListByPage")
    public Result queryCallDeviceScreenListByPage(@RequestBody CallDeviceScreenDTO deviceScreenDTO) {
        return Result.ok(callEquipmentService.queryCallDeviceScreenListByPage(deviceScreenDTO));
    }
}
